package Java;

public class 基本类型和包装类判等 {
    public static void main(String[] args) {
       /*
       //两个为新对象 不等
        Integer i = new Integer(100);
        Integer j = new Integer(100);
        System.out.print(i == j); //false

        */
        //包装类型和基本类型判等，会自动拆箱成基本类型去判断
        /*
        Integer i = new Integer(100);
        int j = 100;
        System.out.print(i == j); //true
         */
        //包装类型new 和常量池拿 不一样
        Integer i = new Integer(100);
        Integer j = 100;
        System.out.print(i == j); //false

        /*
        //两个非new 对象 判断是否在常量池内
        Integer i = 100;
        Integer j = 100;
        System.out.print(i == j); //true
        Integer i = 128;
        Integer j = 128;
        System.out.print(i == j); //false
         */
    }
}
